﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core;
using COFE.Core.Utils;
using COFE.Data.Profile;
using NUnit.Framework;
using COFE.Core.Lister;
using COFE.Core.Entry;

namespace COFE.Data
{
    
    public static class IDBEntryPropertyManagerExtension
    {
        public static bool IsPropertyCached(this IDBEntryPropertyManager epManager, COFEDB2 context, Entry dbEntry, object property)
        {
            return epManager.GetCachedProperties(context, dbEntry).Contains(property);
        }

        //public static void CacheProperties(this IDBEntryPropertyManager epManager, Entry dbEntry,
        //    IPropertyProvider primaryPropertyProvider)
        //{
        //    var entry = COFEShared.EntryConstructor.CreateEntry(dbEntry.SecondaryVolumeId, 
        //        primaryPropertyProvider, Core.Profile.EntryConstructionFlags.DefaultWithoutCache) as
        //        IInternalFileSystemInfoExA;
        //    epManager.CacheProperties(dbEntry, primaryPropertyProvider);
        //}

        public static void CacheProperties(this IDBEntryPropertyManager manager, 
            Guid dbEntryId, IPropertyProvider primaryPropertyProvider)
        {
            manager.CacheProperties(dbEntryId, COFEShared.EntryConstructor.CreateEntry(primaryPropertyProvider,
                Core.Profile.EntryConstructionFlags.DefaultWithoutCache));
        }

    }
}
